﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;

namespace Dycox.Drawing
{
    public abstract class DiagramClosedShape : DiagramShape
    {
        private ContentAlignment _textAlign = ContentAlignment.MiddleCenter;

        public ContentAlignment TextAlign
        {
            get { return _textAlign; }
            set { _textAlign = value; }
        }

        public override bool HitTest(Point location, Graphics g)
        {
            GraphicsPath outline = this.OutlinePath;

            if (outline != null)
            {
                if (!FillColor.IsEmpty)
                    return outline.IsVisible(location, g);

                Pen pen = CreateLinePen(true);

                if (pen != null)
                {
                    outline.IsOutlineVisible(location, pen, g);
                    pen.Dispose();
                }
            }

            return false;
        }

    }
}
